package com.zzyl.member.controller;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author 24029
 */
@RestController
@RequestMapping("/member/orders/project")
@Api(tags = "小程序服务项目信息相关接口")
public class ServiceProjectController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;

    /**
     * 分页查询项目列表
     * @param nursingProject
     * @return
     */
    @ApiOperation("分页查询项目列表")
    @GetMapping("/page")
    public TableDataInfo page(NursingProject nursingProject) {
        startPage();
        List<NursingProject> nursingProjects = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(nursingProjects);
    }

    @GetMapping("/{id}")
    @ApiOperation("获取项目详情")
    public R<NursingProject> getInfo(@PathVariable Long id) {
        NursingProject nursingProject = nursingProjectService.selectNursingProjectById(id);
        return R.ok(nursingProject);
    }
}
